<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>web demo</title>
</head>
<body>
    <div>
        <div class="panel panel-default">
            <div class="panel-heading text-center">创建账户</div>
            <div class="panel-body">
                <div class="col-lg-3"></div>
                <div class="col-lg-6 panel panel-default">
                    <div class="panel-body tabs">
                        <ul id="accountTabs" class="nav nav-tabs">
                            <li class="active"><a href="#tab1" data-toggle="tab">个人账户</a></li>
                            <li><a href="#tab2" data-toggle="tab">企业账户</a></li>
                        </ul>

                        <div class="tab-content">
                            <!--注册个人账户-->
                            <div class="tab-pane fade in active" id="tab1">
                                <form id="person" class="form-horizontal">
                                    <div class="form-group">
                                        <label for="person-mobile" class="col-sm-3 control-label">手机号</label>
                                        <div class="col-sm-9">
                                            <input type="text" class="form-control" id="person-mobile" value="13333333353" >
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="person-email" class="col-sm-3 control-label">邮箱</label>
                                        <div class="col-sm-9">
                                            <input type="text" class="form-control" id="person-email" placeholder="可为空">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="person-name" class="col-sm-3 control-label">姓名</label>
                                        <div class="col-sm-9">
                                            <input type="text" class="form-control" id="person-name" value="个人测试">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="person-id" class="col-sm-3 control-label">身份证号</label>
                                        <div class="col-sm-9">
                                            <input type="text" class="form-control" id="person-id" value="360730198902261416">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">用户归属地</label>
                                        <div class="col-sm-9">
                                            <label class="radio-inline">
                                                <input type="radio" name="person-areaRadios" id="person-area1" value="0" checked>大陆
                                            </label>
                                            <label class="radio-inline">
                                                <input type="radio" name="person-areaRadios" id="person-area2" value="1" >香港
                                            </label>
                                            <label class="radio-inline">
                                                <input type="radio" name="person-areaRadios" id="person-area3" value="2" >澳门
                                            </label>
                                            <label class="radio-inline">
                                                <input type="radio" name="person-areaRadios" id="person-area4" value="3" >台湾
                                            </label>
                                            <label class="radio-inline">
                                                <input type="radio" name="person-areaRadios" id="person-area5" value="4" >外籍
                                            </label>
                                        </div>
                                    </div>
                                    <div class="form-group text-right">
                                        <div class="col-sm-12">
                                            <button type="button" class="btn btn-default" onclick="back()">上一步</button>
                                            <button type="button" class="btn btn-default" id="person-submit">下一步</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <!--注册企业账户-->
                            <div class="tab-pane fade" id="tab2">
                                <form id="enterprise" class="form-horizontal">
                                    <div class="form-group">
                                        <label for="enterprise-mobile" class="col-sm-3 control-label">手机号</label>
                                        <div class="col-sm-9">
                                            <input type="text" class="form-control" id="enterprise-mobile" value="13333333354">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="enterprise-email" class="col-sm-3 control-label">邮箱</label>
                                        <div class="col-sm-9">
                                            <input type="text" class="form-control" id="enterprise-email" placeholder="可为空">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="enterprise-name" class="col-sm-3 control-label">机构名称</label>
                                        <div class="col-sm-9">
                                            <input type="text" class="form-control" id="enterprise-name" value="企业账户测试">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">单位类型</label>
                                        <div class="col-sm-9">
                                            <label class="radio-inline">
                                                <input type="radio" name="organTypeRadios" id="type1" value="0" checked>普通企业
                                            </label>
                                            <label class="radio-inline">
                                                <input type="radio" name="organTypeRadios" id="type2" value="1" >社会团体
                                            </label>
                                            <label class="radio-inline">
                                                <input type="radio" name="organTypeRadios" id="type3" value="2" >事业单位
                                            </label>
                                            <label class="radio-inline">
                                                <input type="radio" name="organTypeRadios" id="type4" value="3" >民办非企业单位
                                            </label>
                                            <label class="radio-inline">
                                                <input type="radio" name="organTypeRadios" id="type5" value="4" >党政及国家机构
                                            </label>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">企业注册类型</label>
                                        <div class="col-sm-9">
                                            <label class="radio-inline">
                                                <input type="radio" name="enterpriseRegisterTypeRadios" id="enterpriseRegisterType1" value="0" checked>组织机构代码号
                                            </label>
                                            <label class="radio-inline">
                                                <input type="radio" name="enterpriseRegisterTypeRadios" id="enterpriseRegisterType2" value="1" >多证合一
                                            </label>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="enterprise-code" class="col-sm-3 control-label">组织机构代码号</label>
                                        <div class="col-sm-9">
                                            <input type="text" class="form-control" id="enterprise-code" value="814187118">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">注册类型</label>
                                        <div class="col-sm-9">
                                            <label class="radio-inline">
                                                <input type="radio" name="registerTypeRadios" id="registerType1" value="1" checked>代理人注册
                                            </label>
                                            <label class="radio-inline">
                                                <input type="radio" name="registerTypeRadios" id="registerType2" value="2" >法人注册
                                            </label>
                                        </div>
                                    </div>
                                    <div class="form-group agent">
                                        <label for="agent-name" class="col-sm-3 control-label">代理人姓名</label>
                                        <div class="col-sm-9">
                                            <input type="text" class="form-control" id="agent-name" value="张三">
                                        </div>
                                    </div>
                                    <div class="form-group agent">
                                        <label for="agent-id" class="col-sm-3 control-label">代理人身份证号</label>
                                        <div class="col-sm-9">
                                            <input type="text" class="form-control" id="agent-id" value="360730198902261416">
                                        </div>
                                    </div>
                                    <div class="form-group legal" style="display: none;">
                                        <label for="legal-name" class="col-sm-3 control-label">法定代表姓名</label>
                                        <div class="col-sm-9">
                                            <input type="text" class="form-control" id="legal-name" value="张三">
                                        </div>
                                    </div>
                                    <div class="form-group legal" style="display: none;">
                                        <label for="legal-id" class="col-sm-3 control-label">法定代表身份证号</label>
                                        <div class="col-sm-9">
                                            <input type="text" class="form-control" id="legal-id" value="360730198902261416">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">法定代表归属地</label>
                                        <div class="col-sm-9">
                                            <label class="radio-inline">
                                                <input type="radio" name="legalRadios" id="legal1" value="0" checked>大陆
                                            </label>
                                            <label class="radio-inline">
                                                <input type="radio" name="legalRadios" id="legal2" value="1" >香港
                                            </label>
                                            <label class="radio-inline">
                                                <input type="radio" name="legalRadios" id="legal3" value="2" >澳门
                                            </label>
                                            <label class="radio-inline">
                                                <input type="radio" name="legalRadios" id="legal4" value="3" >台湾
                                            </label>
                                            <label class="radio-inline">
                                                <input type="radio" name="legalRadios" id="legal5" value="4" >外籍
                                            </label>
                                        </div>
                                    </div>
                                    <div class="form-group text-right">
                                        <div class="col-sm-12">
                                            <button type="button" class="btn btn-default" onclick="back()">上一步</button>
                                            <button type="button" class="btn btn-default" id="enterprise-submit">下一步</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-lg-3"></div>
            </div>
        </div>
    </div>
</body>
<script type="text/javascript">

    $('input[name="registerTypeRadios"]').change(function() {
        if ($(this).val() == "1") {
            $('.agent').show();
            $('.legal').hide();
        } else if ($(this).val() == "2") {
            $('.agent').hide();
            $('.legal').show();
        }
    });
    
    $('input[name="enterpriseRegisterTypeRadios"]').change(function() {
        if ($(this).val() == "0") {
            $('label[for="enterprise-code"]').text('组织机构代码号');
        } else if ($(this).val() == "1") {
            $('label[for="enterprise-code"]').text('社会信用代码号');
        }
    });

    $('#person-submit').click(function() {
        window.person = {
                devId : window.devId,
                accountType : 0,
                mobile : $('#person-mobile').val(),
                email : $('#person-email').val(),
                name : $('#person-name').val(),
                id : $('#person-id').val(),
                area : $('input[name="person-areaRadios"]:checked').val()
        };

            callService("CommonHandle.php?action=addPerson", $.extend(window.person,window.project), (callback = function (data) {
            hideLoading();
            if (data.errCode == 0) {
                window.accountId = data.accountId;
                window.accountType = 0;
                $('#main').load("seal.html");
            } else {
                alertError(data.msg);
            }
        }));
    });

    $('#enterprise-submit').click(function() {
        window.organize = {
                devId : window.devId,
                accountType : 1,
                mobile : $('#enterprise-mobile').val(),
                email : $('#enterprise-email').val(),
                name : $('#enterprise-name').val(),
                organType : $('input[name="organTypeRadios"]:checked').val(),
                regType : $('input[name="enterpriseRegisterTypeRadios"]:checked').val(),
                organCode : $('#enterprise-code').val(),
                userType : $('input[name="registerTypeRadios"]:checked').val(),
                agentName : $('#agent-name').val(),
                agentIdNo : $('#agent-id').val(),
                legalName : $('#legal-name').val(),
                legalIdNo : $('#legal-id').val(),
                legalArea : $('input[name="legalRadios"]:checked').val()
        };
            callService("CommonHandle.php?action=addOrganize",$.extend(window.organize,window.project), (callback = function (data) {
            hideLoading();
            if (data.errCode == 0) {
                window.accountId = data.accountId;
                window.accountType = 1;
                $('#main').load("seal.html");
            } else {
                alertError(data.msg);
            }
        }));
    });
    
    function back() {
        $('#main').load("init.html", function() {
            if (window.project != undefined) {
                $('#projectId').val(window.project.projectId);
                $('#projectSecret').val(window.project.projectSecret);
            }
        });
    }
</script>
</html>